// 文章模块
const express = require('express')
const router = express.Router()
const { cates, addcates, deletecate, updatecate, addArticle } = require('../router_handler/article')
const expressJoi = require('@escook/express-joi')
const { cates_scheam, delete_cate_scheam, update_cate_scheam, add_article_scheam } = require('../schema/user')

// 获取文章分类
router.get('/cates',cates)

// 添加文章分类
router.post('/addcates',expressJoi(cates_scheam),addcates)

// 根据id删除文章分类
router.get('/deletecate/:id',expressJoi(delete_cate_scheam),deletecate)

// 根据id获取分类
router.get('/cates/:id',expressJoi(delete_cate_scheam),cates)

// 更新文章分类
router.post('/updatecate',expressJoi(update_cate_scheam),updatecate)

// 发布文章
router.post('/add',expressJoi(add_article_scheam),addArticle)

module.exports = router
